package com.service.gmall.Item.api;

import com.service.gmall.Item.service.SkuDetailsService;
import com.service.gmall.common.result.Result;
import com.service.gmall.model.to.SkuDetailsTo;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author alpha
 * @className: SkuDetailsApiController
 * @date 2022/8/26 14:58
 * @Description
 */
@Api(tags = "详情页查询")
@RequestMapping("/api/inner/rpc/item")
@RestController
public class SkuDetailsApiController {
    @Autowired
    SkuDetailsService skuDetailsService;
    @GetMapping("/getDetails/{skuId}")
    public Result<SkuDetailsTo> getDetails(@PathVariable("skuId") Long skuId){
        //调用封装好的数据模型在前端展示
        SkuDetailsTo skuDetailsTo = skuDetailsService.getDetails(skuId);
        return Result.ok(skuDetailsTo);
    }
}
